package com.crm.jpaandthymeleaf.entity;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * @author 周敬
 * @version 1.0
 * @packageName com.crm.jpaandthymeleaf.entity
 * @fileName Product
 * @createTime 2021/12/15-20:19-星期三
 * @lastModify 2021/12/15-20:19-星期三
 */
@Entity
public class Product {
    private long prodId;
    private String prodName;
    private String prodType;
    private String prodBatch;
    private String prodUnit;
    private BigDecimal prodPrice;
    private String prodMemo;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "prod_id")
    public long getProdId() {
        return prodId;
    }

    public void setProdId(long prodId) {
        this.prodId = prodId;
    }

    @Basic
    @Column(name = "prod_name")
    public String getProdName() {
        return prodName;
    }

    public void setProdName(String prodName) {
        this.prodName = prodName;
    }

    @Basic
    @Column(name = "prod_type")
    public String getProdType() {
        return prodType;
    }

    public void setProdType(String prodType) {
        this.prodType = prodType;
    }

    @Basic
    @Column(name = "prod_batch")
    public String getProdBatch() {
        return prodBatch;
    }

    public void setProdBatch(String prodBatch) {
        this.prodBatch = prodBatch;
    }

    @Basic
    @Column(name = "prod_unit")
    public String getProdUnit() {
        return prodUnit;
    }

    public void setProdUnit(String prodUnit) {
        this.prodUnit = prodUnit;
    }

    @Basic
    @Column(name = "prod_price")
    public BigDecimal getProdPrice() {
        return prodPrice;
    }

    public void setProdPrice(BigDecimal prodPrice) {
        this.prodPrice = prodPrice;
    }

    @Basic
    @Column(name = "prod_memo")
    public String getProdMemo() {
        return prodMemo;
    }

    public void setProdMemo(String prodMemo) {
        this.prodMemo = prodMemo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Product product = (Product) o;
        return prodId == product.prodId && Objects.equals(prodName, product.prodName) && Objects.equals(prodType, product.prodType) && Objects.equals(prodBatch, product.prodBatch) && Objects.equals(prodUnit, product.prodUnit) && Objects.equals(prodPrice, product.prodPrice) && Objects.equals(prodMemo, product.prodMemo);
    }

    @Override
    public int hashCode() {
        return Objects.hash(prodId, prodName, prodType, prodBatch, prodUnit, prodPrice, prodMemo);
    }
}
